package com.fanfan.controller;

import com.fanfan.response.BaseResponse;
import com.fanfan.entity.db1.T1;
import com.fanfan.entity.db2.T2;
import com.fanfan.mapper.db1.T1Mapper;
import com.fanfan.mapper.db2.T2Mapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: fanfan
 * @Date: 2020/4/5 13:00
 * @description: 测试类
 */
@RestController
public class TestController {
    @Resource
    private T1Mapper t1Mapper; //为了方便这里直接注入了mapper，其实是很不规范的
    @Resource
    private T2Mapper t2Mapper;

    @RequestMapping("/test")
    public BaseResponse test(){
        Map<String,Object> map = new HashMap<>();
        T1 t1 = t1Mapper.selectById(1);
        T2 t2 = t2Mapper.selectById(1);
        map.put("t1",t1);
        map.put("t2",t2);
        return new BaseResponse<>(map);
    }
}
